package controllers

import (
	"blogs/models"
	"blogs/utils"
	beego "github.com/beego/beego/v2/server/web"
)

// Operations about object
type TagController struct {
	beego.Controller
}

// @Title GetAll
// @Description 查询所有标签
// @Success 200 {object} models.Tag
// @Failure 403 :objectId is empty
// @router / [get]
func (o *TagController) GetAll() {
	tag := []models.Tag{}
	utils.DB.Find(&tag)

	o.Data["json"] = map[string]interface{}{
		"msg":  "查询成功",
		"data": tag,
		"code": false,
	}
	o.ServeJSON()
}
